package com.hanock.sm.fork2d;

public class RotateTransform extends Transform {

	private float rotateSpeed;
	private int from;
	private int to;
	
	public RotateTransform(float rotateSpeed, int from, int to) {
		
		this.rotateSpeed = rotateSpeed;
		this.from = from;
		this.to = to;
	}
	
	@Override
	public void progress(Node node, int time) {
		super.progress(node, time);
		
		int act = getActionTime();
		
		if (act < from)
			return;
		
		float r = node.getRotate();
		r += rotateSpeed*time/1000.0f;
		node.setRotate(r);
	}
	
	@Override
	public boolean isFinished() {
		return getActionTime() > to;
	}
}
















